package com.newtouch.cq.base.starter.business.model.vo;

import com.newtouch.cq.lang.em.StatusEnum;
import com.newtouch.cq.lang.user.BaseUserDetails;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;

import java.util.Collection;
import java.util.List;

@Data
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = true)
public class UserVO extends BaseUserDetails implements UserDetails {
	private static final long serialVersionUID = -7697487272496930797L;

	public UserVO setId(Long id) {
		this.id = id;
		return this;
	}
	public UserVO setUsername(String username) {
		this.username = username;
		return this;
	}
	public UserVO setPassword(String password) {
		this.password = password;
		return this;
	}
	public UserVO setSalt(String salt) {
		this.salt = salt;
		return this;
	}
	public UserVO setStatus(StatusEnum status) {
		this.status = status;
		return this;
	}

	public UserVO setOrgId(long orgId) {
		this.orgId = orgId;
		return this;
	}

	public UserVO setOrgIdList(List<Long> orgIdList) {
		this.orgIdList = orgIdList;
		return this;
	}

	@Override
	public Collection<? extends GrantedAuthority> getAuthorities() {
		return null;
	}

	@Override
	public boolean isAccountNonExpired() {
		return true;
	}

	@Override
	public boolean isAccountNonLocked() {
		return true;
	}

	@Override
	public boolean isCredentialsNonExpired() {
		return true;
	}

	@Override
	public boolean isEnabled() {
		return true;
	}
}
